home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the 3D Game Programming Gurus / gurus.iso / DirectX / dx9sdkcp.exe / SDK (C++) / Bin / DXUtils / Visual Studio 6.0 Wizards / Source Code / Cstm2Dlg.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  2002-11-12  |  4.2 KB  |  152 lines

  1. // cstm2dlg.cpp : implementation file
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include "DxAppWiz.h"
  6. #include "cstm2dlg.h"
  7. #include "DXaw.h"
  8.  
  9. #ifdef _PSEUDO_DEBUG
  10. #undef THIS_FILE
  11. static char THIS_FILE[] = __FILE__;
  12. #endif
  13.  
  14. /////////////////////////////////////////////////////////////////////////////
  15. // CCustom2Dlg dialog
  16.  
  17.  
  18. CCustom2Dlg::CCustom2Dlg( CDialogChooser* pChooser )
  19.     : CAppWizStepDlg(CCustom2Dlg::IDD)
  20. {
  21.     m_pChooser = pChooser;
  22.     m_pChooser->m_pDlg2Preview = &m_Preview;
  23.  
  24.     m_bDlgInited    = FALSE;
  25.  
  26.     m_bShowBlank    = m_pChooser->m_bShowBlank;
  27.     m_bShowTriangle = m_pChooser->m_bShowTriangle;
  28.     m_bShowTeapot   = m_pChooser->m_bShowTeapot;
  29.  
  30.     //{{AFX_DATA_INIT(CCustom2Dlg)
  31.     m_bD3DFont      = TRUE;
  32.     m_bXFile        = TRUE;
  33.     //}}AFX_DATA_INIT
  34. }
  35.  
  36.  
  37. void CCustom2Dlg::DoDataExchange(CDataExchange* pDX)
  38. {
  39.     CAppWizStepDlg::DoDataExchange(pDX);
  40.     //{{AFX_DATA_MAP(CCustom2Dlg)
  41.     DDX_Control(pDX, IDC_BACKGROUND, m_Background);
  42.     DDX_Control(pDX, IDC_PREVIEW, m_Preview);
  43.     DDX_Check(pDX, IDC_D3DFONT, m_bD3DFont);
  44.     DDX_Check(pDX, IDC_XFILE, m_bXFile);
  45.     //}}AFX_DATA_MAP
  46. }
  47.  
  48. // This is called whenever the user presses Next, Back, or Finish with this step
  49. //  present.  Do all validation & data exchange from the dialog in this function.
  50. BOOL CCustom2Dlg::OnDismiss()
  51. {
  52.     if( m_bDlgInited )
  53.         UpdateData(TRUE);
  54.  
  55.     if( m_bD3DFont )
  56.         DirectXaw.m_Dictionary["D3DFONT"]="Yes";
  57.     else
  58.         DirectXaw.m_Dictionary.RemoveKey("D3DFONT");
  59.  
  60.     if( m_bXFile )
  61.         DirectXaw.m_Dictionary["X_FILE"]="Yes";
  62.     else
  63.         DirectXaw.m_Dictionary.RemoveKey("X_FILE");
  64.  
  65.     if( m_bShowBlank )
  66.         DirectXaw.m_Dictionary["SHOW_BLANK"]="Yes";
  67.     else
  68.         DirectXaw.m_Dictionary.RemoveKey("SHOW_BLANK");
  69.  
  70.     if( m_bShowTriangle )
  71.         DirectXaw.m_Dictionary["SHOW_TRIANGLE"]="Yes";
  72.     else
  73.         DirectXaw.m_Dictionary.RemoveKey("SHOW_TRIANGLE");
  74.  
  75.     if( m_bShowTeapot )
  76.         DirectXaw.m_Dictionary["SHOW_TEAPOT"]="Yes";
  77.     else
  78.         DirectXaw.m_Dictionary.RemoveKey("SHOW_TEAPOT");
  79.  
  80.     return TRUE;    // return FALSE if the dialog shouldn't be dismissed
  81. }
  82.  
  83.  
  84. void CCustom2Dlg::RemoveAllKeys()
  85. {
  86.     DirectXaw.m_Dictionary.RemoveKey("D3DFONT");
  87.     DirectXaw.m_Dictionary.RemoveKey("X_FILE");
  88.     DirectXaw.m_Dictionary.RemoveKey("SHOW_BLANK");
  89.     DirectXaw.m_Dictionary.RemoveKey("SHOW_TRIANGLE");
  90.     DirectXaw.m_Dictionary.RemoveKey("SHOW_TEAPOT");
  91. }
  92.  
  93. BEGIN_MESSAGE_MAP(CCustom2Dlg, CAppWizStepDlg)
  94.     //{{AFX_MSG_MAP(CCustom2Dlg)
  95.     ON_BN_CLICKED(IDC_SHOW_BLANK, OnShowBlank)
  96.     ON_BN_CLICKED(IDC_SHOW_TEAPOT, OnShowTeapot)
  97.     ON_BN_CLICKED(IDC_SHOW_TRIANGLE, OnShowTriangle)
  98.     //}}AFX_MSG_MAP
  99. END_MESSAGE_MAP()
  100.  
  101.  
  102. /////////////////////////////////////////////////////////////////////////////
  103. // CCustom2Dlg message handlers
  104.  
  105. BOOL CCustom2Dlg::OnInitDialog() 
  106. {
  107.     CAppWizStepDlg::OnInitDialog();
  108.  
  109.     m_bDlgInited = TRUE;
  110.     
  111.     CheckDlgButton( IDC_SHOW_BLANK, (m_bShowBlank) ? BST_CHECKED : BST_UNCHECKED  );
  112.     CheckDlgButton( IDC_SHOW_TEAPOT, (m_bShowTeapot) ? BST_CHECKED : BST_UNCHECKED  );
  113.     CheckDlgButton( IDC_SHOW_TRIANGLE, (m_bShowTriangle) ? BST_CHECKED : BST_UNCHECKED );    
  114.     CheckDlgButton( IDC_D3DFONT, (m_bD3DFont) ? BST_CHECKED : BST_UNCHECKED  );
  115.     CheckDlgButton( IDC_XFILE, (m_bXFile) ? BST_CHECKED : BST_UNCHECKED  );
  116.     
  117.     m_Background.SetBitmap( m_pChooser->m_hBackgroundBitmap );
  118.     m_pChooser->UpdatePreviewAndSteps( &m_Preview );
  119.  
  120.     return TRUE;  // return TRUE unless you set the focus to a control
  121.                   // EXCEPTION: OCX Property Pages should return FALSE
  122. }
  123.  
  124. void CCustom2Dlg::UpdateInfo() 
  125. {
  126.     m_bShowBlank    = IsDlgButtonChecked( IDC_SHOW_BLANK );
  127.     m_bShowTriangle = IsDlgButtonChecked( IDC_SHOW_TRIANGLE );
  128.     m_bShowTeapot   = IsDlgButtonChecked( IDC_SHOW_TEAPOT );
  129.  
  130.     m_pChooser->m_bShowBlank    = m_bShowBlank;
  131.     m_pChooser->m_bShowTriangle = m_bShowTriangle;
  132.     m_pChooser->m_bShowTeapot   = m_bShowTeapot;
  133.  
  134.     m_pChooser->UpdatePreviewAndSteps( &m_Preview );
  135. }
  136.  
  137. void CCustom2Dlg::OnShowBlank() 
  138. {
  139.     UpdateInfo();
  140. }
  141.  
  142. void CCustom2Dlg::OnShowTriangle() 
  143. {
  144.     UpdateInfo();
  145. }
  146.  
  147. void CCustom2Dlg::OnShowTeapot() 
  148. {
  149.     UpdateInfo();
  150. }
  151.  
  152.